<?php
//begin --variabele ophalen--
$action         = $_POST['action'];
$overgang       = $_POST['overgang'];
$kleur          = $_POST['kleur'];
$logo           = $_POST['logo'];
$tijd           = $_POST['tijd'];
$slide          = $_POST['slide'];
$transitiontype = $_POST['transitiontype'];
$duration       = $_POST['duration'];
$overlap        = $_POST['overlap'];
$bands          = $_POST['bands'];
$squaresX       = $_POST['squaresX'];
$squaresY       = $_POST['squaresY'];
$gradientSize   = $_POST['gradientSize'];
$gridSizeX      = $_POST['gridSizeX'];
$gridSizeY      = $_POST['gridSizeY'];
$spokes         = $_POST['spokes'];
include('write_log.php');
//einde --variabele ophalen--
if ($transitiontype == "fadeN"){
$transition="transitiontype='Fade(duration=" . $duration . ",overlap=" . $overlap .")'";	
}
else if ($transitiontype == "barniH"){
$transition="transitiontype='Barn(duration=" . $duration . ",motion=in,orientation=horizontal)'";
}
else if ($transitiontype == "barnoH"){
$transition="transitiontype='Barn(duration=" . $duration . ",motion=out,orientation=horizontal)'";
}
else if ($transitiontype == "barniV"){
$transition="transitiontype='Barn(duration=" . $duration . ",motion=in,orientation=vertical)'";
}
else if ($transitiontype == "barnoV"){
$transition="transitiontype='Barn(duration=" . $duration . ",motion=out,orientation=vertical)'";
}
else if ($transitiontype == "blindsUp"){
$transition="transitiontype='Blinds(duration=" . $duration . ",bands=" . $bands .",direction=up)'";
}
else if ($transitiontype == "blindsDo"){
$transition="transitiontype='Blinds(duration=" . $duration . ",bands=" . $bands .",direction=down)'";
}
else if ($transitiontype == "blindsLe"){
$transition="transitiontype='Blinds(duration=" . $duration . ",bands=" . $bands .",direction=left)'";
}
else if ($transitiontype == "blindsRi"){
$transition="transitiontype='Blinds(duration=" . $duration . ",bands=" . $bands .",direction=right)'";
}
else if ($transitiontype == "CheckerBoardUp"){
$transition="transitiontype='CheckerBoard(duration=" . $duration . ",squaresX=" . $squaresX .",squaresY=" . $squaresY . ",direction=up)'";
}
else if ($transitiontype == "CheckerBoardDown"){
$transition="transitiontype='CheckerBoard(duration=" . $duration . ",squaresX=" . $squaresX .",squaresY=" . $squaresY . ",direction=down)'";
}
else if ($transitiontype == "CheckerBoardLeft"){
$transition="transitiontype='CheckerBoard(duration=" . $duration . ",squaresX=" . $squaresX .",squaresY=" . $squaresY . ",direction=left)'";
}
else if ($transitiontype == "CheckerBoardRight"){
$transition="transitiontype='CheckerBoard(duration=" . $duration . ",squaresX=" . $squaresX .",squaresY=" . $squaresY . ",direction=right)'";
}
else if ($transitiontype == "GradientWipe0R"){
$transition="transitiontype='GradientWipe(duration=" . $duration . ",gradientSize=" . $gradientSize . ",wipeStyle=0,motion=Reverse)'";
}
else if ($transitiontype == "GradientWipe0F"){
$transition="transitiontype='GradientWipe(duration=" . $duration . ",gradientSize=" . $gradientSize . ",wipeStyle=0,motion=Forward)'";
}
else if ($transitiontype == "GradientWipe1R"){
$transition="transitiontype='GradientWipe(duration=" . $duration . ",gradientSize=" . $gradientSize . ",wipeStyle=1,motion=Reverse)'";
}
else if ($transitiontype == "GradientWipe1F"){
$transition="transitiontype='GradientWipe(duration=" . $duration . ",gradientSize=" . $gradientSize . ",wipeStyle=1,motion=Forward)'";
}
else if ($transitiontype == "InSet"){
$transition="transitiontype='InSet(duration=" . $duration . ")'";
}
else if ($transitiontype == "IrisDIAMONDin"){
$transition="transitiontype='Iris(duration=" . $duration . ",irisStyle=DIAMOND,motion=in)'";
}
else if ($transitiontype == "IrisDIAMONDout"){
$transition="transitiontype='Iris(duration=" . $duration . ",irisStyle=DIAMOND,motion=out)'";
}
else if ($transitiontype == "IrisCIRCLEin"){
$transition="transitiontype='Iris(duration=" . $duration . ",irisStyle=CIRCLE,motion=in)'";
}
else if ($transitiontype == "IrisDCIRCLEout"){
$transition="transitiontype='Iris(duration=" . $duration . ",irisStyle=CIRCLE,motion=out)'";
}
else if ($transitiontype == "IrisCROSSin"){
$transition="transitiontype='Iris(duration=" . $duration . ",irisStyle=CROSS,motion=in)'";
}
else if ($transitiontype == "IrisCROSSout"){
$transition="transitiontype='Iris(duration=" . $duration . ",irisStyle=CROSS,motion=out)'";
}
else if ($transitiontype == "IrisPLUSin"){
$transition="transitiontype='Iris(duration=" . $duration . ",irisStyle=PLUS,motion=in)'";
}
else if ($transitiontype == "IrisPLUSout"){
$transition="transitiontype='Iris(duration=" . $duration . ",irisStyle=PLUS,motion=out)'";
}
else if ($transitiontype == "IrisSQUAREin"){
$transition="transitiontype='Iris(duration=" . $duration . ",irisStyle=SQUARE,motion=in)'";
}
else if ($transitiontype == "IrisSQUAREout"){
$transition="transitiontype='Iris(duration=" . $duration . ",irisStyle=SQUARE,motion=out)'";
}
else if ($transitiontype == "IrisSTARin"){
$transition="transitiontype='Iris(duration=" . $duration . ",irisStyle=STAR,motion=in)'";
}
else if ($transitiontype == "IrisSTARout"){
$transition="transitiontype='Iris(duration=" . $duration . ",irisStyle=STAR,motion=out)'";
}
else if ($transitiontype == "Pixelate5"){
$transition="transitiontype='Pixelate(duration=" . $duration . ",maxSquare=5)'";
}
else if ($transitiontype == "Pixelate10"){
$transition="transitiontype='Pixelate(duration=" . $duration . ",maxSquare=10)'";
}
else if ($transitiontype == "Pixelate20"){
$transition="transitiontype='Pixelate(duration=" . $duration . ",maxSquare=20)'";
}
else if ($transitiontype == "Pixelate30"){
$transition="transitiontype='Pixelate(duration=" . $duration . ",maxSquare=30)'";
}
else if ($transitiontype == "Pixelate40"){
$transition="transitiontype='Pixelate(duration=" . $duration . ",maxSquare=40)'";
}
else if ($transitiontype == "Pixelate5O"){
$transition="transitiontype='Pixelate(duration=" . $duration . ",maxSquare=50)'";
}
else if ($transitiontype == "RadialWipeCLOCK"){
$transition="transitiontype='RadialWipe(duration=" . $duration . ",wipeStyle=CLOCK)'";
}
else if ($transitiontype == "RadialWipeWEDGE"){
$transition="transitiontype='RadialWipe(duration=" . $duration . ",wipeStyle=WEDGE)'";
}
else if ($transitiontype == "RadialWipeRADIAL"){
$transition="transitiontype='RadialWipe(duration=" . $duration . ",wipeStyle=RADIAL)'";
}
else if ($transitiontype == "RandomBarsH"){
$transition="transitiontype='RandomBars(duration=" . $duration . ",orientation=horizontal)'";
}
else if ($transitiontype == "RandomBarsV"){
$transition="transitiontype='RandomBars(duration=" . $duration . ",orientation=vertical)'";
}
else if ($transitiontype == "RandomDissolve"){
$transition="transitiontype='RandomDissolve(duration=" . $duration . ")'";
}
else if ($transitiontype == "SlideHIDE"){
$transition="transitiontype='Slide(duration=" . $duration . ",pushStyle=HIDE,bands=" . $bands . ")'";
}
else if ($transitiontype == "SlidePUSH"){
$transition="transitiontype='Slide(duration=" . $duration . ",pushStyle=PUSH,bands=" . $bands . ")'";
}
else if ($transitiontype == "SlideSWAP"){
$transition="transitiontype='Slide(duration=" . $duration . ",pushStyle=SWAP,bands=" . $bands . ")'";
}
else if ($transitiontype == "Spiral"){
$transition="transitiontype='Spiral(duration=" . $duration . ",gridSizeX="  . $gridSizeX . ",gridSizeY="  . $gridSizeY . ")'";
}
else if ($transitiontype == "StretchHIDE"){
$transition="transitiontype='Stretch(duration=" . $duration . ",stretchStyle=HIDE)'";
}
else if ($transitiontype == "StretchPUSH"){
$transition="transitiontype='Stretch(duration=" . $duration . ",stretchStyle=PUSH)'";
}
else if ($transitiontype == "StretchSPIN"){
$transition="transitiontype='Stretch(duration=" . $duration . ",stretchStyle=SPIN)'";
}
else if ($transitiontype == "Stripsleftdown"){
$transition="transitiontype='Strips(duration=" . $duration . ",motion=leftdown)'";
}
else if ($transitiontype == "Stripsleftup"){
$transition="transitiontype='Strips(duration=" . $duration . ",motion=leftup)'";
}
else if ($transitiontype == "Stripsrightdown"){
$transition="transitiontype='Strips(duration=" . $duration . ",motion=rightdown)'";
}
else if ($transitiontype == "Stripsrightup"){
$transition="transitiontype='Strips(duration=" . $duration . ",motion=rightup)'";
}
else if ($transitiontype == "Wheel"){
$transition="transitiontype='Wheel(duration=" . $duration . ",spokes=" . $spokes . ")'"; 
}
else if ($transitiontype == "Zigzag"){
$transition="transitiontype='Zigzag(duration=" . $duration . ",gridSizeX="  . $gridSizeX . ",gridSizeY="  . $gridSizeY . ")'";
}//ovegangen ophalen
logger($transitiontype . ' geslecteerd', 'G');
$conf = "config.inc.php";//configuratiebestand
$fo = fopen($conf, 'w') or logger($conf . "is niet gevonden!", "R");//bestand openen voor schrijven + eventuele fout
//begin --configuratie schrijven--
$config  = "<?php\n";
$config .= "\$overgang = \"" . $overgang . "\";\n";
$config .= "\$kleur = \"" . $kleur . "\";\n";
$config .= "\$logo = \"" .$logo . "\";\n";
$config .= "\$tijd = \"" . $tijd . "\";\n";
$config .= "\$slide = \"" . $slide . "\";\n";
$config .= "\$transition = \"" . $transition . "\";\n";
$config .= "\$duration = \"" . $duration . "\";\n";
$config .= "\$overlap= \"" . $overlap . "\";\n";
$config .= "\$bands = \"" . $bands . "\";\n";
$config .= "\$squaresX = \"" . $squaresX . "\";\n";
$config .= "\$squaresY = \"" . $squaresY . "\";\n";
$config .= "\$gradientSize = \"" . $gradientSize . "\";\n";
$config .= "\$gridSizeX = \"" . $gridSizeX . "\";\n";
$config .= "\$gridSizeY = \"" . $gridSizeY . "\";\n";
$config .= "\$spokes = \"" . $spokes . "\";\n";
$config .= "\$slide = \"" . $slide . "\";\n";
$config .= "?>";
//einde --configuratie schrijven--
$actionF = "action.htm";//achtie bestand
$foa = fopen($actionF, 'w') or logger($actionF . "is niet gevonden!", "R");//bestand openen voor schrijven + eventuele fout
$actie   ="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n";
$actie  .="	<html>\n";
$actie  .="<head>\n";
$actie  .="<meta http-equiv=\"refresh\" content=\"2\">\n";
$actie  .="<script>\n";
$actie  .="window.parent.watMoetIkDoen('herladen');\n";
$actie  .="</script>\n";
$actie  .="</head>\n";
$actie  .="<body>\n";
$actie  .="</body>\n";
$actie  .="</html>\n";
if ($action == "schrijf"){
fwrite($fo, $config);
fclose($fo);
echo"fo complete.";
fwrite($foa, $actie);
fclose($foa);
echo "Instellingen opgeslagen. configuratie wordt verstuurd naar de server...</br>Even geduld A.U.B.";
}
logger('configuratie weggeschreven.','G');
?>
